package com.shaco.heroproject.fragment;

import com.shaco.heroproject.R;
import com.shaco.heroproject.activity.AbilityActivity;
import com.shaco.heroproject.activity.GoodActivity;
import com.shaco.heroproject.activity.SkillActivity;
import com.shaco.heroproject.activity.VideoActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

public class DataFragment extends Fragment implements OnClickListener {
    private RelativeLayout goodLinearIV, skillLinearIV, fuwenLinerIv,videoLinearIV;

    @Override
    @Nullable
    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        return inflater.inflate(R.layout.fragment_data, null);
    }

    @Override
    public void onAttach(Activity activity) {
        // TODO Auto-generated method stub
        super.onAttach(activity);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
        goodLinearIV = (RelativeLayout) getActivity().findViewById(R.id.goodLinearIV);
        goodLinearIV.setOnClickListener(this);
        skillLinearIV = (RelativeLayout) getActivity().findViewById(R.id.skillLinearIV);
        skillLinearIV.setOnClickListener(this);
        fuwenLinerIv = (RelativeLayout) getActivity().findViewById(R.id.fuwenLinerIv);
        fuwenLinerIv.setOnClickListener(this);
        videoLinearIV= (RelativeLayout) getActivity().findViewById(R.id.videoLinearIV);
        videoLinearIV.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {
            case R.id.goodLinearIV:
                //点击物品跳转
                Intent intent = new Intent(getActivity(), GoodActivity.class);
                startActivity(intent);
                break;
            case R.id.skillLinearIV:
                //召唤师技能
                Intent intentSkill = new Intent(getActivity(), SkillActivity.class);
                startActivity(intentSkill);

                break;
            case R.id.videoLinearIV:
                Intent intentVideo=new Intent(getActivity(), VideoActivity.class);
                startActivity(intentVideo);

                break;
            case R.id.fuwenLinerIv:
                Intent intentAbility = new Intent(getActivity(), AbilityActivity.class);
                startActivity(intentAbility);
            break;

            default:
                break;
        }
    }
}
